﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Reference.Apps"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
    x:Class="Reference.Apps.MainPage"
    mc:Ignorable="d" RequestedTheme="Light">
	
	<Page.Background>
		<StaticResource ResourceKey="ApplicationPageBackgroundBrush"/>
	</Page.Background>
	<Page.BottomAppBar>
		<CommandBar>
			<CommandBar.SecondaryCommands>
				<AppBarButton Label="privacy">
					<Interactivity:Interaction.Behaviors>
						<Core:EventTriggerBehavior EventName="Click">
							<Core:NavigateToPageAction TargetPage="Reference.Apps.Privacy"/>
						</Core:EventTriggerBehavior>
					</Interactivity:Interaction.Behaviors>
				</AppBarButton>
			</CommandBar.SecondaryCommands>
			<AppBarButton x:Uid="WP8RefreshAppBarButton" Icon="Refresh" Label="actualizar" Command="{Binding UpdateDataCommand, Mode=OneWay}"/>
			<AppBarButton x:Uid="WP8ViewMoreAppBarButton"  Icon="ViewAll" Label="ver más" Click="ViewMoreAppBarButton_Click"/>
			<AppBarButton x:Uid="WP8SearchAppBarButton"  Icon="Zoom" Label="ver más">
				<Interactivity:Interaction.Behaviors>
					<Core:EventTriggerBehavior EventName="Click">
						<Core:NavigateToPageAction TargetPage="Reference.Apps.SearchView"/>
					</Core:EventTriggerBehavior>
				</Interactivity:Interaction.Behaviors>
			</AppBarButton>
		</CommandBar>
	</Page.BottomAppBar>

	<Page.DataContext>
		<Binding Source="{StaticResource VMLocator}" Mode="OneWay" Path="Main"/>
	</Page.DataContext>
	<Interactivity:Interaction.Behaviors>
		<Core:EventTriggerBehavior EventName="Loaded">
			<Core:InvokeCommandAction Command="{Binding GetDataCommand, Mode=OneWay}"/>
		</Core:EventTriggerBehavior>
	</Interactivity:Interaction.Behaviors>

    <Pivot x:Uid="WP8MainPivot" x:Name="MainPivot" Title="AAA" ItemsSource="{Binding Groups}">
        <Pivot.Resources>
            <DataTemplate x:Key="CodeSnippetsTemplate">
                <Grid>
                    <ListView ItemTemplate="{StaticResource WPCodeSnippetTemplate}" ItemsSource="{Binding Snippets}" ItemClick="SnippetsListItem_Click" IsItemClickEnabled="True" />
                </Grid>
            </DataTemplate>
        </Pivot.Resources>
        <Pivot.Foreground>
            <StaticResource ResourceKey="ApplicationContrastBackgroundBrush"/>
        </Pivot.Foreground>

        <Pivot.ItemTemplate>
            <StaticResource ResourceKey="CodeSnippetsTemplate"/>
        </Pivot.ItemTemplate>
    </Pivot>
</Page>